package com.timanetworks.mailbox.common.response;

/**
 * Created by wusk on 2017/12/1.
 * 接口通用应答消息
 */
public class Message {

    private int code;
    private Object data;
    private Object message;

    private Message(int code){
        this.code = code;
    }

    public static Message ok(){
        return new Message(0);
    }

    public static Message error(){
        return new Message(1);
    }

    public static Message error(int code){
        return new Message(code);
    }

    public Message data(Object d){
        data = d;
        return this;
    }

    public Message message(String m){
        message = m;
        return this;
    }

    public Object getData() {
        return data;
    }

    protected void setData(Object data) {
        this.data = data;
    }

    public Object getMessage() {
        return message;
    }

    protected void setMessage(Object message) {
        this.message = message;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }
}
